<!--

    Copyright (C) 2015 The Gravitee team (http://gravitee.io)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

            http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<div flex>
  <div flex layout="row">
    <div class="gv-sub-menu menu">
      <div class="md-headline">Settings</div>

      <div
        class="aui-nav-heading"
        ng-if="$ctrl.settingsMenu.apiPortalHeader.perm
                 || $ctrl.settingsMenu.clientRegistration.perm
                 || $ctrl.settingsMenu.environmentIdentityProviders.perm
                 || $ctrl.settingsMenu.portalSettings.perm
                 || $ctrl.settingsMenu.documentations.perm
                 || $ctrl.settingsMenu.metadata.perm
                 || $ctrl.settingsMenu.topApis.perm
                 || $ctrl.settingsMenu.categories.perm"
      >
        <strong>Portal</strong>
      </div>
      <ul class="aui-nav">
        <li
          class="iterable-item"
          ng-class="{'aui-nav-selected': $ctrl.$state.includes('management.settings.analytics') ||
                  $ctrl.$state.includes('management.settings.dashboard') || $ctrl.$state.includes('management.settings.dashboardnew')}"
          ng-if="$ctrl.settingsMenu.analytics.perm"
        >
          <a class="execute" ui-sref="{{$ctrl.settingsMenu.analytics.goTo}}">Analytics</a>
        </li>
        <li class="iterable-item" ng-if="$ctrl.settingsMenu.apiPortalHeader.perm" ui-sref-active="aui-nav-selected">
          <a class="execute" ui-sref="{{$ctrl.settingsMenu.apiPortalHeader.goTo}}">API Portal Informations</a>
        </li>
        <li
          class="iterable-item"
          ng-class="{'aui-nav-selected': $ctrl.$state.includes('management.settings.apiQuality') || $ctrl.$state.includes('management.settings.qualityRule') || $ctrl.$state.includes('management.settings.qualityRulenew')}"
          ng-if="$ctrl.settingsMenu.portalSettings.perm"
        >
          <a class="execute" ui-sref="{{$ctrl.settingsMenu.apiQuality.goTo}}">API Quality</a>
        </li>
        <li
          class="iterable-item"
          ng-class="{'aui-nav-selected': $ctrl.$state.includes('management.settings.environment.identityproviders')}"
          ng-if="$ctrl.settingsMenu.environmentIdentityProviders.perm"
        >
          <a class="execute" ui-sref="{{$ctrl.settingsMenu.environmentIdentityProviders.goTo}}">Authentication</a>
        </li>
        <li
          class="iterable-item"
          ng-class="{'aui-nav-selected': $ctrl.$state.includes('management.settings.categories') || $ctrl.$state.includes('management.settings.category') || $ctrl.$state.includes('management.settings.categorynew')}"
          ng-if="$ctrl.settingsMenu.categories.perm"
        >
          <a class="execute" ui-sref="{{$ctrl.settingsMenu.categories.goTo}}">Categories</a>
        </li>
        <li
          class="iterable-item"
          ng-class="{'aui-nav-selected': $ctrl.$state.includes('management.settings.clientregistrationproviders')}"
          ng-if="$ctrl.settingsMenu.clientRegistration.perm"
        >
          <a class="execute" ui-sref="{{$ctrl.settingsMenu.clientRegistration.goTo}}">Client Registration</a>
        </li>
        <li class="iterable-item" ng-if="$ctrl.settingsMenu.documentations.perm" ui-sref-active="aui-nav-selected">
          <a class="execute" ui-sref="{{$ctrl.settingsMenu.documentations.goTo}}">Documentation</a>
        </li>
        <li class="iterable-item" ng-if="$ctrl.settingsMenu.metadata.perm" ui-sref-active="aui-nav-selected">
          <a class="execute" ui-sref="{{$ctrl.settingsMenu.metadata.goTo}}">Metadata</a>
        </li>
        <li class="iterable-item" ng-if="$ctrl.settingsMenu.portalSettings.perm" ui-sref-active="aui-nav-selected">
          <a class="execute" ui-sref="{{$ctrl.settingsMenu.portalSettings.goTo}}">Settings</a>
        </li>
        <li class="iterable-item" ng-if="$ctrl.settingsMenu.theme.perm" ui-sref-active="aui-nav-selected">
          <a class="execute" ui-sref="{{$ctrl.settingsMenu.theme.goTo}}">Theme</a>
        </li>
        <li class="iterable-item" ng-if="$ctrl.settingsMenu.topApis.perm" ui-sref-active="aui-nav-selected">
          <a class="execute" ui-sref="{{$ctrl.settingsMenu.topApis.goTo}}">Top APIs</a>
        </li>
      </ul>

      <div
        class="aui-nav-heading"
        ng-if="$ctrl.settingsMenu.portalSettings.perm
                 || $ctrl.settingsMenu.tags.perm
                 || $ctrl.settingsMenu.tenants.perm
                 || $ctrl.settingsMenu.dictionaries.perm"
      >
        <strong>Gateway</strong>
      </div>
      <ul class="aui-nav">
        <li class="iterable-item" ng-if="$ctrl.settingsMenu.api_logging.perm" ui-sref-active="aui-nav-selected">
          <a class="execute" ui-sref="{{$ctrl.settingsMenu.api_logging.goTo}}">API Logging</a>
        </li>
        <li
          class="iterable-item"
          ng-class="{'aui-nav-selected': $ctrl.$state.includes('management.settings.dictionaries')}"
          ng-if="$ctrl.settingsMenu.dictionaries.perm"
        >
          <a class="execute" ui-sref="{{$ctrl.settingsMenu.dictionaries.goTo}}">Dictionaries</a>
        </li>
        <li class="iterable-item" ng-if="$ctrl.settingsMenu.tags.perm" ui-sref-active="aui-nav-selected">
          <a class="execute" ui-sref="{{$ctrl.settingsMenu.tags.goTo}}">Sharding Tags</a>
        </li>
        <li class="iterable-item" ng-if="$ctrl.settingsMenu.tenants.perm" ui-sref-active="aui-nav-selected">
          <a class="execute" ui-sref="{{$ctrl.settingsMenu.tenants.goTo}}">Tenants</a>
        </li>
      </ul>

      <div
        class="aui-nav-heading"
        ng-if="$ctrl.settingsMenu.customUserFields.perm
                 || $ctrl.settingsMenu.groups.perm"
      >
        <strong>User Management</strong>
      </div>
      <ul class="aui-nav">
        <li
          class="iterable-item"
          ng-class="{'aui-nav-selected': $ctrl.$state.includes('management.settings.customUserFields') }"
          ng-if="$ctrl.settingsMenu.customUserFields.perm"
        >
          <a class="execute" ui-sref="{{$ctrl.settingsMenu.customUserFields.goTo}}">User Fields</a>
        </li>
        <li
          class="iterable-item"
          ng-class="{'aui-nav-selected': $ctrl.$state.includes('management.settings.groups') }"
          ng-if="$ctrl.settingsMenu.groups.perm"
        >
          <a class="execute" ui-sref="{{$ctrl.settingsMenu.groups.goTo}}">Groups</a>
        </li>
      </ul>

      <div class="aui-nav-heading" ng-if="$ctrl.settingsMenu.notifications.perm || $ctrl.settingsMenu.alerts.perm">
        <strong>Notifications</strong>
      </div>
      <ul class="aui-nav">
        <li class="iterable-item" ui-sref-active="aui-nav-selected" ng-if="$ctrl.settingsMenu.notifications.perm">
          <a class="execute" ui-sref="{{$ctrl.settingsMenu.notifications.goTo}}">Notifications</a>
        </li>
      </ul>
      <ul class="aui-nav">
        <li
          class="iterable-item"
          ng-class="{'aui-nav-selected': $ctrl.$state.includes('organization.settings.notificationTemplates') || $ctrl.$state.includes('organization.settings.notificationTemplate') }"
          ng-if="$ctrl.settingsMenu.notificationTemplates.perm"
        >
          <a class="execute" ui-sref="{{$ctrl.settingsMenu.notificationTemplates.goTo}}">Templates</a>
        </li>
      </ul>
      <ul class="aui-nav">
        <li
          class="iterable-item"
          ng-class="{'aui-nav-selected': $ctrl.$state.includes('management.settings.alerts.list') || $ctrl.$state.includes('management.settings.alerts.alertnew') || $ctrl.$state.includes('management.settings.alerts.alert') }"
          ng-if="$ctrl.settingsMenu.alerts.perm"
        >
          <a class="execute" ui-sref="{{$ctrl.settingsMenu.alerts.goTo}}">Alerts</a>
        </li>
      </ul>
    </div>

    <div class="gv-sub-content" flex layout="column" ui-view></div>
  </div>
</div>
